package com.bawei.yangzongcai___day2.MaiDongFangQi.day15;

import com.bawei.yangzongcai___day2.MVPActivity.JavaMVP;
import com.bawei.yangzongcai___day2.MaiDongFangQi.day15.MMVVPP.M.BasemmvvppModel;

import java.util.List;

import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * create by ertu
 * create on 2021/8/3
 * description
 */
public class DooModel extends BasemmvvppModel implements DoodYueshu.foodmodeloo{

    @Override
    public void getdateoo(final DoodCallBack doodCallBack) {
        Okmmvvppclass.getOkmmvvppclass().retrofit("http://www.qubaobei.com/ios/cf/").create(apq.class).dooget()
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.computation())
                .subscribe(new Observer<JavaMVP>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(JavaMVP javaMVP) {
                        //如果成功的话就把集合java类给接口成功
                        List<JavaMVP.DataBean> dataBeans = javaMVP.getData();
                        doodCallBack.succeoo(dataBeans);
                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }
}
